using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using LocalizationTest.Tools;

namespace LocalizationTest
{
  public class DepthMeasurement : Measurement
  {
    private double depth;
    public DepthMeasurement()
    {
      this.depth = 0;
      this.sensor = null;
    }

    public DepthMeasurement(double depth, Sensor sensor)
    {
      this.depth = depth;
      this.sensor = sensor;
    }
    public double Depth
    {
      get { return depth; }
    }

    public override double GetValueAsDouble()
    {
      return this.depth;
    }

    public override double GetDifference(Measurement other)
    {
      return this.depth - ((DepthMeasurement)other).depth;
    }
    public override Measurement Parse(string str, Experiment experiment)
    {
      string[] parts = str.Split('/');
      Sensor sensor = experiment.GetSensorByString(parts[0]);
      double depth = double.Parse(parts[1]);
      return new DepthMeasurement(depth, sensor);
    }

    public override string ToString()
    {
      return
        this.GetType().Name + "|" +
        this.sensor.ToString() + "/" +
        depth.ToString();
    }
  }
}
